import request from '@/utils/http';

// 根据一级分类id，获取二级分类列表
export const getSecondCategoryList = (id) => request({
    url: '/category',
    method: 'GET',
    params: {
        id
    }
});

// 根据二级分类id，获取二级分类相关数据
export const getSecondGoodsList = (id) => request({
    url: '/category/sub/filter',
    method: 'GET',
    params: {
        id
    }
});

/**
 * 获取二级分类下的商品信息
 * data {
 *      categoryId: 1005000,
 *      page: 1,
 *      pageSize: 20,
 *      sortField: 'publishTime' | 'orderNum' | 'evaluateNum'
 * }
 * */
export const getSubCategoryInfo = (data) => request({
    url: '/category/goods/temporary',
    method: 'POST',
    data
})